package com.trade.data.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.trade.data.dao.entity.PredictInfo;
import com.trade.data.dao.service.PredictInfoService;
import com.trade.data.dto.PredictInfoDto;
import com.trade.data.dto.common.ApiResponse;
import com.trade.data.manager.PredictManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class PredictionController {
    @Autowired
    PredictInfoService predictInfoService;



    @GetMapping("/api/predictDetails")
    public String getPredictionDetails(@RequestParam String predictUniqueTag, Model model) {
        List<PredictInfo> list = predictInfoService.list(new LambdaQueryWrapper<PredictInfo>().eq(PredictInfo::
                getPredictUniqueTag, predictUniqueTag));
        List<PredictInfoDto> predictInfoDtos = BeanUtil.copyToList(list, PredictInfoDto.class);
        model.addAttribute("predictions", predictInfoDtos);
        return "predictDetails";
    }


}

